﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Elderlyhealth.BLL;

public partial class NewUser : System.Web.UI.Page
{
    CustomerService customerSrv = new CustomerService();
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnOk_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            //调用CustomerService类中的IsNameExist()方法判断用户名是否重名
            if (customerSrv.IsNameExist(txtName.Text.Trim()))
            {
                lblMsg.Text = "用户名已存在！";
            }
            else
            {
                //调用CustomerService类中的Insert()方法插入新用户记录
                customerSrv.Insert(txtName.Text.Trim(), txtTelephone.Text.Trim(), txtPwd.Text.Trim(), txtEmail.Text.Trim());
                Response.Redirect("Login.aspx?name=" + txtName.Text);
            }
        }
    }

    protected void txtName_TextChanged(object sender, EventArgs e)
    {

    }
    protected void txtold_TextChanged(object sender, EventArgs e)
    {
        // 根据需要添加逻辑，例如更新某些状态或显示提示信息
        lblMsg.Text = "老人 ID 已修改。";
    }

    protected void txtTelephone_TextChanged(object sender, EventArgs e)
    {
        // 根据需要添加逻辑，例如验证电话号码格式或其他操作
        lblMsg.Text = "电话已修改。";
    }

}